<template>
	<view class="goods-item">
		<view class="left">
				<radio :checked="goods.goods_state" @click="checkedChange(goods)" color="#c00000" v-if="radioShow" />
			<image :src="defaultImg" mode=""></image>
		</view>
		<view class="right">
			<view class="title">{{goods.goods_name}}</view>
			<view class="price">￥{{goods.goods_price | priceFixed}}</view>
			<uni-number-box :value="goods.goods_count" @change="changNum"></uni-number-box>
		</view>
	</view>
</template>
<script>
	export default {
		props: ['goods','radioShow','numShow'],
		data() {
			return {
				defaultImg: this.goods.goods_big_logo || 'https://img1.baidu.com/it/u=415449740,540746270&fm=253&fmt=auto&app=138&f=GIF?w=500&h=500'
			}
		},
		filters : {
			priceFixed(num) {
				return num.toFixed(2)
			}
		},
		methods: {
			checkedChange(goods) {
				this.$emit('getCheckedState',goods)
			},
			changNum(num) {
				let {goods_id} = this.goods
				this.$store.commit('cart/getGoodsCount',{id:goods_id,num:num})
			}
		}
	}
</script>
<style lang="scss">
</style>